home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / FREENET / BRODIE / INTERNET / !InternetD / c / netwall < prev    next >
Text File  |  1995-05-16  |  998b  |  43 lines

  1. #include "inetd.h"
  2. #include "netwall.h"
  3. #include "templates.h"
  4. #include "oslib:osmodule.h"
  5.  
  6. static void netwall_exit(void)
  7. {
  8.         xosmodule_free(sys()->data.netwall);
  9. }
  10.  
  11. int netwall_init(void)
  12. {
  13.         sys()->data.netwall = osmodule_alloc(sizeof(struct netwall));
  14.         if (sys()->data.netwall) {
  15.                 atexit(netwall_exit);
  16.         sys()->data.netwall->want_foreground = 0;
  17.         }
  18.         return (sys()->data.netwall != NULL);
  19. }
  20.  
  21. void netwall_udp(int s)
  22. {
  23.     int    length;
  24.  
  25.     length = recv(s, sys()->data.netwall->buffer, NETWALLSIZE, 0);
  26.     if (length > 0) {
  27.             if (length >= NETWALLSIZE) length = NETWALLSIZE-1;
  28.             sys()->data.netwall->buffer[length] = '\0';
  29.             sys()->data.netwall->want_foreground = 1;
  30.             ++(sys()->wimp_poll_word);
  31.     }
  32. }
  33.  
  34. void netwall_fg_data(inet_handler *ih)
  35. {
  36.         UNUSED(ih);
  37.  
  38.     if (sys()->data.netwall->want_foreground) {
  39.             sys()->data.netwall->want_foreground = 0;
  40.             template_get_error_box(sys()->data.netwall->buffer);
  41.     }
  42. }
  43.